--------------------------------------------------------------------------------
      name:  <unnamed>
       log:  R:\Current Research\Markets-Pridemore\Work\MAR01-DataClean.log
  log type:  text
 opened on:  25 Jun 2024, 15:01:11

. 
. //  program:    Stata 
. //  task:       Merging Data Together and Cleaning  
. //  project:    Market
. 
. version
version 17.0

. clear all

. macro drop _all

. set linesize 80

. set more off

. local tag "06-05-23 | Cleanup 06-06-2024"

. local file "MAR01-DataClean"

. local note "|`tag' | `file'"

. 
. 
. //      #0
. //      Loading Data
. insheet using 00-Pridemore-Foundation-05-31-23.csv, comma clear n
(5 vars, 3,480 obs)

. rename Nation nation

. 
. gen CID=. 
(3,480 missing values generated)

. do 000-CID-nation.do

. replace CID=    4       if nation=="Afghanistan"
(0 real changes made)

. replace CID=    248     if nation=="Aland Islands"
(0 real changes made)

. replace CID=    8       if nation=="Albania"
(21 real changes made)

. replace CID=    12      if nation=="Algeria"
(21 real changes made)

. replace CID=    16      if nation=="American Samoa"
(0 real changes made)

. replace CID=    20      if nation=="Andorra"
(0 real changes made)

. replace CID=    24      if nation=="Angola"
(21 real changes made)

. replace CID=    660     if nation=="Anguilla"
(0 real changes made)

. replace CID=    10      if nation=="Antarctica"
(0 real changes made)

. replace CID=    28      if nation=="Antigua and Barbuda"
(0 real changes made)

. replace CID=    32      if nation=="Argentina"
(21 real changes made)

. replace CID=    51      if nation=="Armenia"
(21 real changes made)

. replace CID=    533     if nation=="Aruba"
(0 real changes made)

. replace CID=    36      if nation=="Australia"
(21 real changes made)

. replace CID=    40      if nation=="Austria"
(21 real changes made)

. replace CID=    31      if nation=="Azerbaijan"
(21 real changes made)

. replace CID=    44      if nation=="Bahamas"
(0 real changes made)

. replace CID=    44      if nation=="Bahamas, The"
(21 real changes made)

. replace CID=    48      if nation=="Bahrain"
(21 real changes made)

. replace CID=    50      if nation=="Bangladesh"
(21 real changes made)

. replace CID=    52      if nation=="Barbados"
(21 real changes made)

. replace CID=    112     if nation=="Belarus"
(21 real changes made)

. replace CID=    56      if nation=="Belgium"
(21 real changes made)

. replace CID=    84      if nation=="Belize"
(21 real changes made)

. replace CID=    204     if nation=="Benin"
(21 real changes made)

. replace CID=    60      if nation=="Bermuda"
(0 real changes made)

. replace CID=    64      if nation=="Bhutan"
(21 real changes made)

. replace CID=    68      if nation=="Bolivia"
(21 real changes made)

. replace CID=    70      if nation=="Bosnia and Herzegovina"
(21 real changes made)

. replace CID=    72      if nation=="Botswana"
(21 real changes made)

. replace CID=    74      if nation=="Bouvet Island"
(0 real changes made)

. replace CID=    76      if nation=="Brazil"
(21 real changes made)

. replace CID=    86      if nation=="British Indian Ocean Territory"
(0 real changes made)

. replace CID=    92      if nation=="British Virgin Islands"
(0 real changes made)

. replace CID=    96      if nation=="Brunei Darussalam"
(21 real changes made)

. replace CID=    100     if nation=="Bulgaria"
(21 real changes made)

. replace CID=    854     if nation=="Burkina Faso"
(21 real changes made)

. replace CID=    108     if nation=="Burundi"
(21 real changes made)

. replace CID=    116     if nation=="Cambodia"
(21 real changes made)

. replace CID=    120     if nation=="Cameroon"
(21 real changes made)

. replace CID=    124     if nation=="Canada"
(21 real changes made)

. replace CID=    132     if nation=="Cabo Verde"
(21 real changes made)

. replace CID=    132     if nation=="Cape Verde"
(0 real changes made)

. replace CID=    136     if nation=="Cayman Islands"
(0 real changes made)

. replace CID=    140     if nation=="Central African Republic"
(21 real changes made)

. replace CID=    148     if nation=="Chad"
(21 real changes made)

. replace CID=    152     if nation=="Chile"
(21 real changes made)

. replace CID=    156     if nation=="China"
(21 real changes made)

. replace CID=    162     if nation=="Christmas Island"
(0 real changes made)

. replace CID=    166     if nation=="Cocos (Keeling) Islands"
(0 real changes made)

. replace CID=    170     if nation=="Colombia"
(21 real changes made)

. replace CID=    174     if nation=="Comoros"
(21 real changes made)

. replace CID=    178     if nation=="Congo (Brazzaville)"
(0 real changes made)

. replace CID=    178     if nation=="Congo, Rep."
(21 real changes made)

. replace CID=    180     if nation=="Congo, Democratic Republic of the"
(0 real changes made)

. replace CID=    180     if nation=="Congo, Dem. Rep."
(21 real changes made)

. replace CID=    184     if nation=="Cook Islands"
(0 real changes made)

. replace CID=    188     if nation=="Costa Rica"
(21 real changes made)

. replace CID=    191     if nation=="Croatia"
(21 real changes made)

. replace CID=    192     if nation=="Cuba"
(0 real changes made)

. replace CID=    196     if nation=="Cyprus"
(21 real changes made)

. replace CID=    203     if nation=="Czech Republic"
(21 real changes made)

. replace CID=    384     if nation=="Côte d'Ivoire"
(0 real changes made)

. replace CID=    384     if nation=="Cote d'Ivoire"
(21 real changes made)

. replace CID=    208     if nation=="Denmark"
(21 real changes made)

. replace CID=    262     if nation=="Djibouti"
(21 real changes made)

. replace CID=    212     if nation=="Dominica"
(0 real changes made)

. replace CID=    214     if nation=="Dominican Republic"
(21 real changes made)

. replace CID=    218     if nation=="Ecuador"
(21 real changes made)

. replace CID=    818     if nation=="Egypt"
(0 real changes made)

. replace CID=    818     if nation=="Egypt, Arab Rep."
(21 real changes made)

. replace CID=    222     if nation=="El Salvador"
(21 real changes made)

. replace CID=    226     if nation=="Equatorial Guinea"
(0 real changes made)

. replace CID=    232     if nation=="Eritrea"
(0 real changes made)

. replace CID=    233     if nation=="Estonia"
(21 real changes made)

. replace CID=    231     if nation=="Ethiopia"
(21 real changes made)

. replace CID=    238     if nation=="Falkland Islands (Malvinas)"
(0 real changes made)

. replace CID=    234     if nation=="Faroe Islands"
(0 real changes made)

. replace CID=    242     if nation=="Fiji"
(21 real changes made)

. replace CID=    246     if nation=="Finland"
(21 real changes made)

. replace CID=    250     if nation=="France"
(21 real changes made)

. replace CID=    254     if nation=="French Guiana"
(0 real changes made)

. replace CID=    258     if nation=="French Polynesia"
(0 real changes made)

. replace CID=    260     if nation=="French Southern Territories"
(0 real changes made)

. replace CID=    266     if nation=="Gabon"
(21 real changes made)

. replace CID=    270     if nation=="Gambia"
(0 real changes made)

. replace CID=    270     if nation=="Gambia, The"
(21 real changes made)

. replace CID=    268     if nation=="Georgia"
(21 real changes made)

. replace CID=    276     if nation=="Germany"
(21 real changes made)

. replace CID=    288     if nation=="Ghana"
(21 real changes made)

. replace CID=    292     if nation=="Gibraltar"
(0 real changes made)

. replace CID=    300     if nation=="Greece"
(21 real changes made)

. replace CID=    304     if nation=="Greenland"
(0 real changes made)

. replace CID=    308     if nation=="Grenada"
(0 real changes made)

. replace CID=    312     if nation=="Guadeloupe"
(0 real changes made)

. replace CID=    316     if nation=="Guam"
(0 real changes made)

. replace CID=    320     if nation=="Guatemala"
(21 real changes made)

. replace CID=    831     if nation=="Guernsey"
(0 real changes made)

. replace CID=    324     if nation=="Guinea"
(21 real changes made)

. replace CID=    624     if nation=="Guinea-Bissau"
(21 real changes made)

. replace CID=    328     if nation=="Guyana"
(21 real changes made)

. replace CID=    332     if nation=="Haiti"
(21 real changes made)

. replace CID=    334     if nation=="Heard Island and Mcdonald Islands"
(0 real changes made)

. replace CID=    336     if nation=="Holy See (Vatican City State)"
(0 real changes made)

. replace CID=    340     if nation=="Honduras"
(21 real changes made)

. replace CID=    344     if nation=="Hong Kong SAR"
(0 real changes made)

. replace CID=    344     if nation=="Hong Kong SAR, China"
(21 real changes made)

. replace CID=    348     if nation=="Hungary"
(21 real changes made)

. replace CID=    352     if nation=="Iceland"
(21 real changes made)

. replace CID=    356     if nation=="India"
(21 real changes made)

. replace CID=    360     if nation=="Indonesia"
(21 real changes made)

. replace CID=    364     if nation=="Iran (Islamic Republic of)"
(0 real changes made)

. replace CID=    364     if nation=="Iran, Islamic Rep."
(21 real changes made)

. replace CID=    368     if nation=="Iraq"
(21 real changes made)

. replace CID=    372     if nation=="Ireland"
(21 real changes made)

. replace CID=    833     if nation=="Isle of Man"
(0 real changes made)

. replace CID=    376     if nation=="Israel"
(21 real changes made)

. replace CID=    380     if nation=="Italy"
(21 real changes made)

. replace CID=    388     if nation=="Jamaica"
(21 real changes made)

. replace CID=    392     if nation=="Japan"
(21 real changes made)

. replace CID=    832     if nation=="Jersey"
(0 real changes made)

. replace CID=    400     if nation=="Jordan"
(21 real changes made)

. replace CID=    398     if nation=="Kazakhstan"
(21 real changes made)

. replace CID=    404     if nation=="Kenya"
(21 real changes made)

. replace CID=    296     if nation=="Kiribati"
(0 real changes made)

. replace CID=    408     if nation=="Korea, Democratic People's Republic of"
(0 real changes made)

. replace CID=    410     if nation=="Republic of Korea"
(0 real changes made)

. replace CID=    410     if nation=="Korea, Rep."
(21 real changes made)

. replace CID=    414     if nation=="Kuwait"
(21 real changes made)

. replace CID=    417     if nation=="Kyrgyzstan"
(0 real changes made)

. replace CID=    417     if nation=="Kyrgyz Republic"
(21 real changes made)

. replace CID=    418     if nation=="Lao PDR"
(21 real changes made)

. replace CID=    428     if nation=="Latvia"
(21 real changes made)

. replace CID=    422     if nation=="Lebanon"
(21 real changes made)

. replace CID=    426     if nation=="Lesotho"
(21 real changes made)

. replace CID=    430     if nation=="Liberia"
(21 real changes made)

. replace CID=    434     if nation=="Libya"
(21 real changes made)

. replace CID=    438     if nation=="Liechtenstein"
(0 real changes made)

. replace CID=    440     if nation=="Lithuania"
(21 real changes made)

. replace CID=    442     if nation=="Luxembourg"
(21 real changes made)

. replace CID=    446     if nation=="Macau"
(0 real changes made)

. replace CID=    807     if nation=="TFYR Macedonia"
(0 real changes made)

. replace CID=    807     if nation=="North Macedonia"
(21 real changes made)

. replace CID=    450     if nation=="Madagascar"
(21 real changes made)

. replace CID=    454     if nation=="Malawi"
(21 real changes made)

. replace CID=    458     if nation=="Malaysia"
(21 real changes made)

. replace CID=    462     if nation=="Maldives"
(0 real changes made)

. replace CID=    466     if nation=="Mali"
(21 real changes made)

. replace CID=    470     if nation=="Malta"
(21 real changes made)

. replace CID=    584     if nation=="Marshall Islands"
(0 real changes made)

. replace CID=    474     if nation=="Martinique"
(0 real changes made)

. replace CID=    478     if nation=="Mauritania"
(21 real changes made)

. replace CID=    480     if nation=="Mauritius"
(21 real changes made)

. replace CID=    175     if nation=="Mayotte"
(0 real changes made)

. replace CID=    484     if nation=="Mexico"
(21 real changes made)

. replace CID=    583     if nation=="Micronesia, Federated States of"
(0 real changes made)

. replace CID=    498     if nation=="Republic of Moldova"
(0 real changes made)

. replace CID=    498     if nation=="Moldova"
(21 real changes made)

. replace CID=    492     if nation=="Monaco"
(0 real changes made)

. replace CID=    496     if nation=="Mongolia"
(21 real changes made)

. replace CID=    499     if nation=="Montenegro"
(21 real changes made)

. replace CID=    500     if nation=="Montserrat"
(0 real changes made)

. replace CID=    504     if nation=="Morocco"
(21 real changes made)

. replace CID=    508     if nation=="Mozambique"
(21 real changes made)

. replace CID=    104     if nation=="Myanmar"
(21 real changes made)

. replace CID=    516     if nation=="Namibia"
(21 real changes made)

. replace CID=    520     if nation=="Nauru"
(0 real changes made)

. replace CID=    524     if nation=="Nepal"
(21 real changes made)

. replace CID=    528     if nation=="Netherlands"
(21 real changes made)

. replace CID=    530     if nation=="Netherlands Antilles"
(0 real changes made)

. replace CID=    540     if nation=="New Caledonia"
(0 real changes made)

. replace CID=    554     if nation=="New Zealand"
(21 real changes made)

. replace CID=    558     if nation=="Nicaragua"
(21 real changes made)

. replace CID=    562     if nation=="Niger"
(21 real changes made)

. replace CID=    566     if nation=="Nigeria"
(21 real changes made)

. replace CID=    570     if nation=="Niue"
(0 real changes made)

. replace CID=    574     if nation=="Norfolk Island"
(0 real changes made)

. replace CID=    580     if nation=="Northern Mariana Islands"
(0 real changes made)

. replace CID=    578     if nation=="Norway"
(21 real changes made)

. replace CID=    512     if nation=="Oman"
(21 real changes made)

. replace CID=    586     if nation=="Pakistan"
(21 real changes made)

. replace CID=    585     if nation=="Palau"
(0 real changes made)

. replace CID=    275     if nation=="Occupied Palestinian Territory"
(0 real changes made)

. replace CID=    591     if nation=="Panama"
(21 real changes made)

. replace CID=    598     if nation=="Papua New Guinea"
(21 real changes made)

. replace CID=    600     if nation=="Paraguay"
(21 real changes made)

. replace CID=    604     if nation=="Peru"
(21 real changes made)

. replace CID=    608     if nation=="Philippines"
(21 real changes made)

. replace CID=    612     if nation=="Pitcairn"
(0 real changes made)

. replace CID=    616     if nation=="Poland"
(21 real changes made)

. replace CID=    620     if nation=="Portugal"
(21 real changes made)

. replace CID=    630     if nation=="Puerto Rico"
(0 real changes made)

. replace CID=    634     if nation=="Qatar"
(21 real changes made)

. replace CID=    642     if nation=="Romania"
(21 real changes made)

. replace CID=    643     if nation=="Russian Federation"
(21 real changes made)

. replace CID=    646     if nation=="Rwanda"
(21 real changes made)

. replace CID=    638     if nation=="Reunion"
(0 real changes made)

. replace CID=    654     if nation=="Saint Helena"
(0 real changes made)

. replace CID=    659     if nation=="Saint Kitts and Nevis"
(0 real changes made)

. replace CID=    662     if nation=="Saint Lucia"
(0 real changes made)

. replace CID=    666     if nation=="Saint Pierre and Miquelon"
(0 real changes made)

. replace CID=    670     if nation=="Saint Vincent and Grenadines"
(0 real changes made)

. replace CID=    652     if nation=="Saint-Barthélemy"
(0 real changes made)

. replace CID=    663     if nation=="Saint-Martin (French part)"
(0 real changes made)

. replace CID=    882     if nation=="Samoa"
(0 real changes made)

. replace CID=    674     if nation=="San Marino"
(0 real changes made)

. replace CID=    678     if nation=="Sao Tome and Principe"
(0 real changes made)

. replace CID=    682     if nation=="Saudi Arabia"
(21 real changes made)

. replace CID=    686     if nation=="Senegal"
(21 real changes made)

. replace CID=    688     if nation=="Serbia"
(21 real changes made)

. replace CID=    690     if nation=="Seychelles"
(21 real changes made)

. replace CID=    694     if nation=="Sierra Leone"
(21 real changes made)

. replace CID=    702     if nation=="Singapore"
(21 real changes made)

. replace CID=    703     if nation=="Slovakia"
(0 real changes made)

. replace CID=    703     if nation=="Slovak Republic"
(21 real changes made)

. replace CID=    705     if nation=="Slovenia"
(21 real changes made)

. replace CID=    90      if nation=="Solomon Islands"
(0 real changes made)

. replace CID=    706     if nation=="Somalia"
(21 real changes made)

. replace CID=    710     if nation=="South Africa"
(21 real changes made)

. replace CID=    239     if nation=="South Georgia and the South Sandwich Islan
> ds"
(0 real changes made)

. replace CID=    728     if nation=="South Sudan"
(0 real changes made)

. replace CID=    724     if nation=="Spain"
(21 real changes made)

. replace CID=    144     if nation=="Sri Lanka"
(21 real changes made)

. replace CID=    736     if nation=="Sudan"
(21 real changes made)

. replace CID=    740     if nation=="Suriname"
(21 real changes made)

. replace CID=    744     if nation=="Svalbard and Jan Mayen Islands"
(0 real changes made)

. replace CID=    748     if nation=="Swaziland"
(0 real changes made)

. replace CID=    748     if nation=="Eswatini"
(21 real changes made)

. replace CID=    752     if nation=="Sweden"
(21 real changes made)

. replace CID=    756     if nation=="Switzerland"
(21 real changes made)

. replace CID=    760     if nation=="Syrian Arab Republic"
(21 real changes made)

. replace CID=    158     if nation=="Taiwan, Republic of China"
(0 real changes made)

. replace CID=    158     if nation=="Taiwan"
(21 real changes made)

. replace CID=    158     if nation=="China: Province of Taiwan only"
(0 real changes made)

. replace CID=    762     if nation=="Tajikistan"
(21 real changes made)

. replace CID=    834     if nation=="Tanzania *, United Republic of"
(0 real changes made)

. replace CID=    834     if nation=="Tanzania"
(21 real changes made)

. replace CID=    764     if nation=="Thailand"
(21 real changes made)

. replace CID=    626     if nation=="Timor-Leste"
(21 real changes made)

. replace CID=    768     if nation=="Togo"
(21 real changes made)

. replace CID=    772     if nation=="Tokelau"
(0 real changes made)

. replace CID=    776     if nation=="Tonga"
(0 real changes made)

. replace CID=    780     if nation=="Trinidad and Tobago"
(21 real changes made)

. replace CID=    788     if nation=="Tunisia"
(21 real changes made)

. replace CID=    792     if nation=="Turkey"
(21 real changes made)

. replace CID=    795     if nation=="Turkmenistan"
(0 real changes made)

. replace CID=    796     if nation=="Turks and Caicos Islands"
(0 real changes made)

. replace CID=    798     if nation=="Tuvalu"
(0 real changes made)

. replace CID=    800     if nation=="Uganda"
(21 real changes made)

. replace CID=    804     if nation=="Ukraine"
(21 real changes made)

. replace CID=    784     if nation=="United Arab Emirates"
(21 real changes made)

. replace CID=    826     if nation=="United Kingdom"
(21 real changes made)

. replace CID=    581     if nation=="United States Minor Outlying Islands"
(0 real changes made)

. replace CID=    840     if nation=="United States of America"
(0 real changes made)

. replace CID=    840     if nation=="United States"
(21 real changes made)

. replace CID=    858     if nation=="Uruguay"
(21 real changes made)

. replace CID=    860     if nation=="Uzbekistan"
(15 real changes made)

. replace CID=    548     if nation=="Vanuatu"
(0 real changes made)

. replace CID=    862     if nation=="Venezuela (Bolivarian Republic of)"
(0 real changes made)

. replace CID=    862     if nation=="Venezuela, RB"
(21 real changes made)

. replace CID=    862     if nation=="Venezuela"
(0 real changes made)

. replace CID=    704     if nation=="Viet Nam"
(0 real changes made)

. replace CID=    704     if nation=="Vietnam"
(21 real changes made)

. replace CID=    850     if nation=="Virgin Islands (USA)"
(0 real changes made)

. replace CID=    876     if nation=="Wallis and Futuna Islands"
(0 real changes made)

. replace CID=    732     if nation=="Western Sahara"
(0 real changes made)

. replace CID=    887     if nation=="Yemen"
(0 real changes made)

. replace CID=    887     if nation=="Yemen, Rep."
(21 real changes made)

. replace CID=    894     if nation=="Zambia"
(21 real changes made)

. replace CID=    716     if nation=="Zimbabwe"
(21 real changes made)

. 
. 
. replace CID=    200 if nation=="Czechoslovakia, Former"
(0 real changes made)

. replace CID=    278 if nation=="Germany, Former Democratic Republic"
(0 real changes made)

. replace CID=    280 if nation=="Germany, Former Federal Republic"
(0 real changes made)

. replace CID=    284 if nation=="Germany, West Berlin"
(0 real changes made)

. replace CID=    891     if nation=="Serbia and Montenegro, Former"
(0 real changes made)

. replace CID=    810 if nation=="USSR, Former"
(0 real changes made)

. replace CID=    890 if nation=="Yugoslavia, Former"
(0 real changes made)

. replace CID=    8260 if nation=="United Kingdom, England and Wales"
(0 real changes made)

. replace CID=    8261 if nation=="United Kingdom, Northern Ireland"
(0 real changes made)

. replace CID=    8262 if nation=="United Kingdom, Scotland"
(0 real changes made)

. replace CID=    650 if nation=="Ryu Kyu Islands"
(0 real changes made)

. replace CID=    9999 if nation=="Rodrigues"
(0 real changes made)

. 
. 
. 
end of do-file

. tab nation if CID==. 
no observations

. order CID nation year, first 

. save 00-Fraser.dta, replace 
file 00-Fraser.dta saved

. 
. 
. //      #1
. //      SP data
. insheet using OECD-SP-Public-Total-06-27-24.csv, comma clear n 
(44 vars, 38 obs)

. reshape long v,  j(year) i(Country)
(j = 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
>  30 31 32 33 34 35 36 37 38 39 40 41 42 43 44)

Data                               Wide   ->   Long
-----------------------------------------------------------------------------
Number of observations               38   ->   1,634       
Number of variables                  44   ->   3           
j variable (43 values)                    ->   year
xij variables:
                          v2 v3 ... v44   ->   v
-----------------------------------------------------------------------------

. rename Country nation 

. rename v public_sp

. 
. gen CID=. 
(1,634 missing values generated)

. do 00-CID-nation.do

. //  program:    Stata 14
. //  task:       Assigning CID #
. //  project:    SuiAlc 
. 
. //      #0A
. replace CID=    4       if nation=="Afghanistan"
(0 real changes made)

. replace CID=    248     if nation=="Aland Islands"
(0 real changes made)

. replace CID=    8       if nation=="Albania"
(0 real changes made)

. replace CID=    12      if nation=="Algeria"
(0 real changes made)

. replace CID=    16      if nation=="American Samoa"
(0 real changes made)

. replace CID=    20      if nation=="Andorra"
(0 real changes made)

. replace CID=    24      if nation=="Angola"
(0 real changes made)

. replace CID=    660     if nation=="Anguilla"
(0 real changes made)

. replace CID=    10      if nation=="Antarctica"
(0 real changes made)

. replace CID=    28      if nation=="Antigua and Barbuda"
(0 real changes made)

. replace CID=    32      if nation=="Argentina"
(0 real changes made)

. replace CID=    51      if nation=="Armenia"
(0 real changes made)

. replace CID=    533     if nation=="Aruba"
(0 real changes made)

. replace CID=    36      if nation=="Australia"
(43 real changes made)

. replace CID=    40      if nation=="Austria"
(43 real changes made)

. replace CID=    31      if nation=="Azerbaijan"
(0 real changes made)

. replace CID=    44      if nation=="Bahamas"
(0 real changes made)

. replace CID=    48      if nation=="Bahrain"
(0 real changes made)

. replace CID=    50      if nation=="Bangladesh"
(0 real changes made)

. replace CID=    52      if nation=="Barbados"
(0 real changes made)

. replace CID=    112     if nation=="Belarus"
(0 real changes made)

. replace CID=    56      if nation=="Belgium"
(43 real changes made)

. replace CID=    84      if nation=="Belize"
(0 real changes made)

. replace CID=    204     if nation=="Benin"
(0 real changes made)

. replace CID=    60      if nation=="Bermuda"
(0 real changes made)

. replace CID=    64      if nation=="Bhutan"
(0 real changes made)

. replace CID=    68      if nation=="Bolivia (Plurinational State of)"
(0 real changes made)

. replace CID=    70      if nation=="Bosnia and Herzegovina"
(0 real changes made)

. replace CID=    72      if nation=="Botswana"
(0 real changes made)

. replace CID=    74      if nation=="Bouvet Island"
(0 real changes made)

. replace CID=    76      if nation=="Brazil"
(0 real changes made)

. replace CID=    86      if nation=="British Indian Ocean Territory"
(0 real changes made)

. replace CID=    92      if nation=="British Virgin Islands"
(0 real changes made)

. replace CID=    96      if nation=="Brunei Darussalam"
(0 real changes made)

. replace CID=    100     if nation=="Bulgaria"
(0 real changes made)

. replace CID=    854     if nation=="Burkina Faso"
(0 real changes made)

. replace CID=    108     if nation=="Burundi"
(0 real changes made)

. replace CID=    116     if nation=="Cambodia"
(0 real changes made)

. replace CID=    120     if nation=="Cameroon"
(0 real changes made)

. replace CID=    124     if nation=="Canada"
(43 real changes made)

. replace CID=    132     if nation=="Cabo Verde"
(0 real changes made)

. replace CID=    136     if nation=="Cayman Islands"
(0 real changes made)

. replace CID=    140     if nation=="Central African Republic"
(0 real changes made)

. replace CID=    148     if nation=="Chad"
(0 real changes made)

. replace CID=    152     if nation=="Chile"
(43 real changes made)

. replace CID=    156     if nation=="China"
(0 real changes made)

. replace CID=    162     if nation=="Christmas Island"
(0 real changes made)

. replace CID=    166     if nation=="Cocos (Keeling) Islands"
(0 real changes made)

. replace CID=    170     if nation=="Colombia"
(43 real changes made)

. replace CID=    174     if nation=="Comoros"
(0 real changes made)

. replace CID=    178     if nation=="Congo"
(0 real changes made)

. replace CID=    180     if nation=="Congo (Democratic Republic of the)"
(0 real changes made)

. replace CID=    184     if nation=="Cook Islands"
(0 real changes made)

. replace CID=    188     if nation=="Costa Rica"
(43 real changes made)

. replace CID=    191     if nation=="Croatia"
(0 real changes made)

. replace CID=    192     if nation=="Cuba"
(0 real changes made)

. replace CID=    196     if nation=="Cyprus"
(0 real changes made)

. replace CID=    203     if nation=="Czech Republic"
(0 real changes made)

. replace CID=    203     if nation=="Czechia"
(43 real changes made)

. 
. replace CID=    384     if nation=="Cote d'Ivoire"
(0 real changes made)

. replace CID=    208     if nation=="Denmark"
(43 real changes made)

. replace CID=    262     if nation=="Djibouti"
(0 real changes made)

. replace CID=    212     if nation=="Dominica"
(0 real changes made)

. replace CID=    214     if nation=="Dominican Republic"
(0 real changes made)

. replace CID=    218     if nation=="Ecuador"
(0 real changes made)

. replace CID=    818     if nation=="Egypt"
(0 real changes made)

. replace CID=    222     if nation=="El Salvador"
(0 real changes made)

. replace CID=    226     if nation=="Equatorial Guinea"
(0 real changes made)

. replace CID=    232     if nation=="Eritrea"
(0 real changes made)

. replace CID=    233     if nation=="Estonia"
(43 real changes made)

. replace CID=    231     if nation=="Ethiopia"
(0 real changes made)

. replace CID=    238     if nation=="Falkland Islands (Malvinas)"
(0 real changes made)

. replace CID=    234     if nation=="Faroe Islands"
(0 real changes made)

. replace CID=    242     if nation=="Fiji"
(0 real changes made)

. replace CID=    246     if nation=="Finland"
(43 real changes made)

. replace CID=    250     if nation=="France"
(43 real changes made)

. replace CID=    254     if nation=="French Guiana"
(0 real changes made)

. replace CID=    258     if nation=="French Polynesia"
(0 real changes made)

. replace CID=    260     if nation=="French Southern Territories"
(0 real changes made)

. replace CID=    266     if nation=="Gabon"
(0 real changes made)

. replace CID=    270     if nation=="Gambia"
(0 real changes made)

. replace CID=    268     if nation=="Georgia"
(0 real changes made)

. replace CID=    276     if nation=="Germany"
(43 real changes made)

. replace CID=    288     if nation=="Ghana"
(0 real changes made)

. replace CID=    292     if nation=="Gibraltar"
(0 real changes made)

. replace CID=    300     if nation=="Greece"
(43 real changes made)

. replace CID=    304     if nation=="Greenland"
(0 real changes made)

. replace CID=    308     if nation=="Grenada"
(0 real changes made)

. replace CID=    312     if nation=="Guadeloupe"
(0 real changes made)

. replace CID=    316     if nation=="Guam"
(0 real changes made)

. replace CID=    320     if nation=="Guatemala"
(0 real changes made)

. replace CID=    831     if nation=="Guernsey"
(0 real changes made)

. replace CID=    324     if nation=="Guinea"
(0 real changes made)

. replace CID=    624     if nation=="Guinea-Bissau"
(0 real changes made)

. replace CID=    328     if nation=="Guyana"
(0 real changes made)

. replace CID=    332     if nation=="Haiti"
(0 real changes made)

. replace CID=    334     if nation=="Heard Island and Mcdonald Islands"
(0 real changes made)

. replace CID=    336     if nation=="Holy See (Vatican City State)"
(0 real changes made)

. replace CID=    340     if nation=="Honduras"
(0 real changes made)

. replace CID=    344     if nation==" Hong Kong, China (SAR)"
(0 real changes made)

. replace CID=    348     if nation=="Hungary"
(43 real changes made)

. replace CID=    352     if nation=="Iceland"
(43 real changes made)

. replace CID=    356     if nation=="India"
(0 real changes made)

. replace CID=    360     if nation=="Indonesia"
(0 real changes made)

. replace CID=    364     if nation=="Iran (Islamic Republic of)"
(0 real changes made)

. replace CID=    368     if nation=="Iraq"
(0 real changes made)

. replace CID=    372     if nation=="Ireland"
(43 real changes made)

. replace CID=    833     if nation=="Isle of Man"
(0 real changes made)

. replace CID=    376     if nation=="Israel"
(43 real changes made)

. replace CID=    380     if nation=="Italy"
(43 real changes made)

. replace CID=    388     if nation=="Jamaica"
(0 real changes made)

. replace CID=    392     if nation=="Japan"
(43 real changes made)

. replace CID=    832     if nation=="Jersey"
(0 real changes made)

. replace CID=    400     if nation=="Jordan"
(0 real changes made)

. replace CID=    398     if nation=="Kazakhstan"
(0 real changes made)

. replace CID=    404     if nation=="Kenya"
(0 real changes made)

. replace CID=    296     if nation=="Kiribati"
(0 real changes made)

. replace CID=    408     if nation=="Democratic People's Republic of Korea"
(0 real changes made)

. replace CID=    410     if nation=="Korea (Republic of)"
(0 real changes made)

. replace CID=    410     if nation=="Korea"
(43 real changes made)

. 
. replace CID=    414     if nation=="Kuwait"
(0 real changes made)

. replace CID=    417     if nation=="Kyrgyzstan"
(0 real changes made)

. replace CID=    418     if nation=="Lao People's Democratic Republic"
(0 real changes made)

. replace CID=    428     if nation=="Latvia"
(43 real changes made)

. replace CID=    422     if nation=="Lebanon"
(0 real changes made)

. replace CID=    426     if nation=="Lesotho"
(0 real changes made)

. replace CID=    430     if nation=="Liberia"
(0 real changes made)

. replace CID=    434     if nation=="Libya"
(0 real changes made)

. replace CID=    438     if nation=="Liechtenstein"
(0 real changes made)

. replace CID=    440     if nation=="Lithuania"
(43 real changes made)

. replace CID=    442     if nation=="Luxembourg"
(43 real changes made)

. replace CID=    446     if nation=="Macao Special Administrative Region of Chi
> na"
(0 real changes made)

. replace CID=    807     if nation=="The former Yugoslav Republic of Macedonia"
(0 real changes made)

. replace CID=    450     if nation=="Madagascar"
(0 real changes made)

. replace CID=    454     if nation=="Malawi"
(0 real changes made)

. replace CID=    458     if nation=="Malaysia"
(0 real changes made)

. replace CID=    462     if nation=="Maldives"
(0 real changes made)

. replace CID=    466     if nation=="Mali"
(0 real changes made)

. replace CID=    470     if nation=="Malta"
(0 real changes made)

. replace CID=    584     if nation=="Marshall Islands"
(0 real changes made)

. replace CID=    474     if nation=="Martinique"
(0 real changes made)

. replace CID=    478     if nation=="Mauritania"
(0 real changes made)

. replace CID=    480     if nation=="Mauritius"
(0 real changes made)

. replace CID=    175     if nation=="Mayotte"
(0 real changes made)

. replace CID=    484     if nation=="Mexico"
(43 real changes made)

. replace CID=    583     if nation=="Micronesia (Federated States of)"
(0 real changes made)

. replace CID=    498     if nation=="Moldova (Republic of)"
(0 real changes made)

. replace CID=    492     if nation=="Monaco"
(0 real changes made)

. replace CID=    496     if nation=="Mongolia"
(0 real changes made)

. replace CID=    499     if nation=="Montenegro"
(0 real changes made)

. replace CID=    500     if nation=="Montserrat"
(0 real changes made)

. replace CID=    504     if nation=="Morocco"
(0 real changes made)

. replace CID=    508     if nation=="Mozambique"
(0 real changes made)

. replace CID=    104     if nation=="Myanmar"
(0 real changes made)

. replace CID=    516     if nation=="Namibia"
(0 real changes made)

. replace CID=    520     if nation=="Nauru"
(0 real changes made)

. replace CID=    524     if nation=="Nepal"
(0 real changes made)

. replace CID=    528     if nation=="Netherlands"
(43 real changes made)

. replace CID=    530     if nation=="Netherlands Antilles"
(0 real changes made)

. replace CID=    540     if nation=="New Caledonia"
(0 real changes made)

. replace CID=    554     if nation=="New Zealand"
(43 real changes made)

. replace CID=    558     if nation=="Nicaragua"
(0 real changes made)

. replace CID=    562     if nation=="Niger"
(0 real changes made)

. replace CID=    566     if nation=="Nigeria"
(0 real changes made)

. replace CID=    570     if nation=="Niue"
(0 real changes made)

. replace CID=    574     if nation=="Norfolk Island"
(0 real changes made)

. replace CID=    580     if nation=="Northern Mariana Islands"
(0 real changes made)

. replace CID=    578     if nation=="Norway"
(43 real changes made)

. replace CID=    512     if nation=="Oman"
(0 real changes made)

. replace CID=    586     if nation=="Pakistan"
(0 real changes made)

. replace CID=    585     if nation=="Palau"
(0 real changes made)

. replace CID=    275     if nation=="Palestinian Territory, Occupied"
(0 real changes made)

. replace CID=    591     if nation=="Panama"
(0 real changes made)

. replace CID=    598     if nation=="Papua New Guinea"
(0 real changes made)

. replace CID=    600     if nation=="Paraguay"
(0 real changes made)

. replace CID=    604     if nation=="Peru"
(0 real changes made)

. replace CID=    608     if nation=="Philippines"
(0 real changes made)

. replace CID=    612     if nation=="Pitcairn"
(0 real changes made)

. replace CID=    616     if nation=="Poland"
(43 real changes made)

. replace CID=    620     if nation=="Portugal"
(43 real changes made)

. replace CID=    630     if nation=="Puerto Rico"
(0 real changes made)

. replace CID=    634     if nation=="Qatar"
(0 real changes made)

. replace CID=    642     if nation=="Romania"
(0 real changes made)

. replace CID=    643     if nation=="Russian Federation"
(0 real changes made)

. replace CID=    646     if nation=="Rwanda"
(0 real changes made)

. replace CID=    638     if nation=="Réunion"
(0 real changes made)

. replace CID=    654     if nation=="Saint Helena"
(0 real changes made)

. replace CID=    659     if nation=="Saint Kitts and Nevis"
(0 real changes made)

. replace CID=    662     if nation=="Saint Lucia"
(0 real changes made)

. replace CID=    666     if nation=="Saint Pierre and Miquelon"
(0 real changes made)

. replace CID=    670     if nation=="Saint Vincent and the Grenadines"
(0 real changes made)

. replace CID=    652     if nation=="Saint-Barthélemy"
(0 real changes made)

. replace CID=    663     if nation=="Saint-Martin (French part)"
(0 real changes made)

. replace CID=    882     if nation=="Samoa"
(0 real changes made)

. replace CID=    674     if nation=="San Marino"
(0 real changes made)

. replace CID=    678     if nation=="Sao Tome and Principe"
(0 real changes made)

. replace CID=    682     if nation=="Saudi Arabia"
(0 real changes made)

. replace CID=    686     if nation=="Senegal"
(0 real changes made)

. replace CID=    688     if nation=="Serbia"
(0 real changes made)

. replace CID=    690     if nation=="Seychelles"
(0 real changes made)

. replace CID=    694     if nation=="Sierra Leone"
(0 real changes made)

. replace CID=    702     if nation=="Singapore"
(0 real changes made)

. replace CID=    703     if nation=="Slovakia"
(0 real changes made)

. replace CID=    703     if nation=="Slovak Republic"
(43 real changes made)

. 
. replace CID=    705     if nation=="Slovenia"
(43 real changes made)

. replace CID=    90      if nation=="Solomon Islands"
(0 real changes made)

. replace CID=    706     if nation=="Somalia"
(0 real changes made)

. replace CID=    710     if nation=="South Africa"
(0 real changes made)

. replace CID=    239     if nation=="South Georgia and the South Sandwich Islan
> ds"
(0 real changes made)

. replace CID=    728     if nation=="South Sudan"
(0 real changes made)

. replace CID=    724     if nation=="Spain"
(43 real changes made)

. replace CID=    144     if nation=="Sri Lanka"
(0 real changes made)

. replace CID=    736     if nation=="Sudan"
(0 real changes made)

. replace CID=    740     if nation=="Suriname"
(0 real changes made)

. replace CID=    744     if nation=="Svalbard and Jan Mayen Islands"
(0 real changes made)

. replace CID=    748     if nation=="Swaziland"
(0 real changes made)

. replace CID=    752     if nation=="Sweden"
(43 real changes made)

. replace CID=    756     if nation=="Switzerland"
(43 real changes made)

. replace CID=    760     if nation=="Syrian Arab Republic"
(0 real changes made)

. replace CID=    158     if nation=="Taiwan, Republic of China"
(0 real changes made)

. replace CID=    762     if nation=="Tajikistan"
(0 real changes made)

. replace CID=    834     if nation=="Tanzania (United Republic of)"
(0 real changes made)

. replace CID=    764     if nation=="Thailand"
(0 real changes made)

. replace CID=    626     if nation=="Timor-Leste"
(0 real changes made)

. replace CID=    768     if nation=="Togo"
(0 real changes made)

. replace CID=    772     if nation=="Tokelau"
(0 real changes made)

. replace CID=    776     if nation=="Tonga"
(0 real changes made)

. replace CID=    780     if nation=="Trinidad and Tobago"
(0 real changes made)

. replace CID=    788     if nation=="Tunisia"
(0 real changes made)

. replace CID=    792     if nation=="Turkey"
(0 real changes made)

. replace CID=    792     if nation=="Türkiye"
(43 real changes made)

. replace CID=    795     if nation=="Turkmenistan"
(0 real changes made)

. replace CID=    796     if nation=="Turks and Caicos Islands"
(0 real changes made)

. replace CID=    798     if nation=="Tuvalu"
(0 real changes made)

. replace CID=    800     if nation=="Uganda"
(0 real changes made)

. replace CID=    804     if nation=="Ukraine"
(0 real changes made)

. replace CID=    784     if nation=="United Arab Emirates"
(0 real changes made)

. replace CID=    826     if nation=="United Kingdom"
(43 real changes made)

. replace CID=    581     if nation=="United States Minor Outlying Islands"
(0 real changes made)

. replace CID=    840     if nation=="United States"
(43 real changes made)

. replace CID=    858     if nation=="Uruguay"
(0 real changes made)

. replace CID=    860     if nation=="Uzbekistan"
(0 real changes made)

. replace CID=    548     if nation=="Vanuatu"
(0 real changes made)

. replace CID=    862     if nation=="Venezuela (Bolivarian Republic of)"
(0 real changes made)

. replace CID=    704     if nation=="Viet Nam"
(0 real changes made)

. replace CID=    850     if nation=="Virgin Islands, US"
(0 real changes made)

. replace CID=    876     if nation=="Wallis and Futuna Islands"
(0 real changes made)

. replace CID=    732     if nation=="Western Sahara"
(0 real changes made)

. replace CID=    887     if nation=="Yemen"
(0 real changes made)

. replace CID=    894     if nation=="Zambia"
(0 real changes made)

. replace CID=    716     if nation=="Zimbabwe"
(0 real changes made)

. 
. //
. 
end of do-file

. tab nation if CID==.
no observations

. order CID nation year, first 

. save SPOECD.dta, replace 
file SPOECD.dta saved

. 
. //      #2
. //      LaFree Globalization Data
. use KOFGI_2023_public.dta, clear 

. rename code countrycode

. gen CID=.
(11,180 missing values generated)

. do 00-CID-CountryCode.do

. replace CID=    4       if countrycode=="AFG"
(52 real changes made)

. replace CID=    248     if countrycode=="ALA"
(0 real changes made)

. replace CID=    8       if countrycode=="ALB"
(52 real changes made)

. replace CID=    12      if countrycode=="DZA"
(52 real changes made)

. replace CID=    16      if countrycode=="ASM"
(0 real changes made)

. replace CID=    20      if countrycode=="AND"
(0 real changes made)

. replace CID=    24      if countrycode=="AGO"
(52 real changes made)

. replace CID=    660     if countrycode=="AIA"
(0 real changes made)

. replace CID=    10      if countrycode=="ATA"
(0 real changes made)

. replace CID=    28      if countrycode=="ATG"
(52 real changes made)

. replace CID=    32      if countrycode=="ARG"
(52 real changes made)

. replace CID=    51      if countrycode=="ARM"
(52 real changes made)

. replace CID=    533     if countrycode=="ABW"
(52 real changes made)

. replace CID=    36      if countrycode=="AUS"
(52 real changes made)

. replace CID=    40      if countrycode=="AUT"
(52 real changes made)

. replace CID=    31      if countrycode=="AZE"
(52 real changes made)

. replace CID=    44      if countrycode=="BHS"
(52 real changes made)

. replace CID=    48      if countrycode=="BHR"
(52 real changes made)

. replace CID=    50      if countrycode=="BGD"
(52 real changes made)

. replace CID=    52      if countrycode=="BRB"
(52 real changes made)

. replace CID=    112     if countrycode=="BLR"
(52 real changes made)

. replace CID=    56      if countrycode=="BEL"
(52 real changes made)

. replace CID=    84      if countrycode=="BLZ"
(52 real changes made)

. replace CID=    204     if countrycode=="BEN"
(52 real changes made)

. replace CID=    60      if countrycode=="BMU"
(52 real changes made)

. replace CID=    64      if countrycode=="BTN"
(52 real changes made)

. replace CID=    68      if countrycode=="BOL"
(52 real changes made)

. replace CID=    70      if countrycode=="BIH"
(52 real changes made)

. replace CID=    72      if countrycode=="BWA"
(52 real changes made)

. replace CID=    74      if countrycode=="BVT"
(0 real changes made)

. replace CID=    76      if countrycode=="BRA"
(52 real changes made)

. replace CID=    86      if countrycode=="IOT"
(0 real changes made)

. replace CID=    92      if countrycode=="VGB"
(0 real changes made)

. replace CID=    96      if countrycode=="BRN"
(52 real changes made)

. replace CID=    100     if countrycode=="BGR"
(52 real changes made)

. replace CID=    854     if countrycode=="BFA"
(52 real changes made)

. replace CID=    108     if countrycode=="BDI"
(52 real changes made)

. replace CID=    116     if countrycode=="KHM"
(52 real changes made)

. replace CID=    120     if countrycode=="CMR"
(52 real changes made)

. replace CID=    124     if countrycode=="CAN"
(52 real changes made)

. replace CID=    132     if countrycode=="CPV"
(52 real changes made)

. replace CID=    136     if countrycode=="CYM"
(52 real changes made)

. replace CID=    140     if countrycode=="CAF"
(52 real changes made)

. replace CID=    148     if countrycode=="TCD"
(52 real changes made)

. replace CID=    152     if countrycode=="CHL"
(52 real changes made)

. replace CID=    156     if countrycode=="CHN"
(52 real changes made)

. replace CID=    162     if countrycode=="CXR"
(0 real changes made)

. replace CID=    166     if countrycode=="CCK"
(0 real changes made)

. replace CID=    170     if countrycode=="COL"
(52 real changes made)

. replace CID=    174     if countrycode=="COM"
(52 real changes made)

. replace CID=    178     if countrycode=="COG"
(52 real changes made)

. replace CID=    180     if countrycode=="COD"
(0 real changes made)

. replace CID=    184     if countrycode=="COK"
(0 real changes made)

. replace CID=    188     if countrycode=="CRI"
(52 real changes made)

. replace CID=    191     if countrycode=="HRV"
(52 real changes made)

. replace CID=    192     if countrycode=="CUB"
(52 real changes made)

. replace CID=    196     if countrycode=="CYP"
(52 real changes made)

. replace CID=    203     if countrycode=="CZE"
(52 real changes made)

. replace CID=    384     if countrycode=="CIV"
(52 real changes made)

. replace CID=    208     if countrycode=="DNK"
(52 real changes made)

. replace CID=    262     if countrycode=="DJI"
(52 real changes made)

. replace CID=    212     if countrycode=="DMA"
(52 real changes made)

. replace CID=    214     if countrycode=="DOM"
(52 real changes made)

. replace CID=    218     if countrycode=="ECU"
(52 real changes made)

. replace CID=    818     if countrycode=="EGY"
(52 real changes made)

. replace CID=    222     if countrycode=="SLV"
(52 real changes made)

. replace CID=    226     if countrycode=="GNQ"
(52 real changes made)

. replace CID=    232     if countrycode=="ERI"
(52 real changes made)

. replace CID=    233     if countrycode=="EST"
(52 real changes made)

. replace CID=    231     if countrycode=="ETH"
(52 real changes made)

. replace CID=    238     if countrycode=="FLK"
(0 real changes made)

. replace CID=    234     if countrycode=="FRO"
(52 real changes made)

. replace CID=    242     if countrycode=="FJI"
(52 real changes made)

. replace CID=    246     if countrycode=="FIN"
(52 real changes made)

. replace CID=    250     if countrycode=="FRA"
(52 real changes made)

. replace CID=    254     if countrycode=="GUF"
(0 real changes made)

. replace CID=    258     if countrycode=="PYF"
(52 real changes made)

. replace CID=    260     if countrycode=="ATF"
(0 real changes made)

. replace CID=    266     if countrycode=="GAB"
(52 real changes made)

. replace CID=    270     if countrycode=="GMB"
(52 real changes made)

. replace CID=    268     if countrycode=="GEO"
(52 real changes made)

. replace CID=    276     if countrycode=="DEU"
(52 real changes made)

. replace CID=    288     if countrycode=="GHA"
(52 real changes made)

. replace CID=    292     if countrycode=="GIB"
(0 real changes made)

. replace CID=    300     if countrycode=="GRC"
(52 real changes made)

. replace CID=    304     if countrycode=="GRL"
(52 real changes made)

. replace CID=    308     if countrycode=="GRD"
(52 real changes made)

. replace CID=    312     if countrycode=="GLP"
(0 real changes made)

. replace CID=    316     if countrycode=="GUM"
(52 real changes made)

. replace CID=    320     if countrycode=="GTM"
(52 real changes made)

. replace CID=    831     if countrycode=="GGY"
(0 real changes made)

. replace CID=    324     if countrycode=="GIN"
(52 real changes made)

. replace CID=    624     if countrycode=="GNB"
(52 real changes made)

. replace CID=    328     if countrycode=="GUY"
(52 real changes made)

. replace CID=    332     if countrycode=="HTI"
(52 real changes made)

. replace CID=    334     if countrycode=="HMD"
(0 real changes made)

. replace CID=    336     if countrycode=="VAT"
(0 real changes made)

. replace CID=    340     if countrycode=="HND"
(52 real changes made)

. replace CID=    344     if countrycode=="HKG"
(52 real changes made)

. replace CID=    348     if countrycode=="HUN"
(52 real changes made)

. replace CID=    352     if countrycode=="ISL"
(52 real changes made)

. replace CID=    356     if countrycode=="IND"
(52 real changes made)

. replace CID=    360     if countrycode=="IDN"
(52 real changes made)

. replace CID=    364     if countrycode=="IRN"
(52 real changes made)

. replace CID=    368     if countrycode=="IRQ"
(52 real changes made)

. replace CID=    372     if countrycode=="IRL"
(52 real changes made)

. replace CID=    833     if countrycode=="IMN"
(0 real changes made)

. replace CID=    376     if countrycode=="ISR"
(52 real changes made)

. replace CID=    380     if countrycode=="ITA"
(52 real changes made)

. replace CID=    388     if countrycode=="JAM"
(52 real changes made)

. replace CID=    392     if countrycode=="JPN"
(52 real changes made)

. replace CID=    832     if countrycode=="JEY"
(0 real changes made)

. replace CID=    400     if countrycode=="JOR"
(52 real changes made)

. replace CID=    398     if countrycode=="KAZ"
(52 real changes made)

. replace CID=    404     if countrycode=="KEN"
(52 real changes made)

. replace CID=    296     if countrycode=="KIR"
(52 real changes made)

. replace CID=    408     if countrycode=="PRK"
(52 real changes made)

. replace CID=    410     if countrycode=="KOR"
(52 real changes made)

. replace CID=    414     if countrycode=="KWT"
(52 real changes made)

. replace CID=    417     if countrycode=="KGZ"
(52 real changes made)

. replace CID=    418     if countrycode=="LAO"
(52 real changes made)

. replace CID=    428     if countrycode=="LVA"
(52 real changes made)

. replace CID=    422     if countrycode=="LBN"
(52 real changes made)

. replace CID=    426     if countrycode=="LSO"
(52 real changes made)

. replace CID=    430     if countrycode=="LBR"
(52 real changes made)

. replace CID=    434     if countrycode=="LBY"
(52 real changes made)

. replace CID=    438     if countrycode=="LIE"
(52 real changes made)

. replace CID=    440     if countrycode=="LTU"
(52 real changes made)

. replace CID=    442     if countrycode=="LUX"
(52 real changes made)

. replace CID=    446     if countrycode=="MAC"
(52 real changes made)

. replace CID=    807     if countrycode=="MKD"
(52 real changes made)

. replace CID=    450     if countrycode=="MDG"
(52 real changes made)

. replace CID=    454     if countrycode=="MWI"
(52 real changes made)

. replace CID=    458     if countrycode=="MYS"
(52 real changes made)

. replace CID=    462     if countrycode=="MDV"
(52 real changes made)

. replace CID=    466     if countrycode=="MLI"
(52 real changes made)

. replace CID=    470     if countrycode=="MLT"
(52 real changes made)

. replace CID=    584     if countrycode=="MHL"
(52 real changes made)

. replace CID=    474     if countrycode=="MTQ"
(0 real changes made)

. replace CID=    478     if countrycode=="MRT"
(52 real changes made)

. replace CID=    480     if countrycode=="MUS"
(52 real changes made)

. replace CID=    175     if countrycode=="MYT"
(0 real changes made)

. replace CID=    484     if countrycode=="MEX"
(52 real changes made)

. replace CID=    583     if countrycode=="FSM"
(52 real changes made)

. replace CID=    498     if countrycode=="MDA"
(52 real changes made)

. replace CID=    492     if countrycode=="MCO"
(52 real changes made)

. replace CID=    496     if countrycode=="MNG"
(52 real changes made)

. replace CID=    499     if countrycode=="MNE"
(52 real changes made)

. replace CID=    500     if countrycode=="MSR"
(0 real changes made)

. replace CID=    504     if countrycode=="MAR"
(52 real changes made)

. replace CID=    508     if countrycode=="MOZ"
(52 real changes made)

. replace CID=    104     if countrycode=="MMR"
(52 real changes made)

. replace CID=    516     if countrycode=="NAM"
(52 real changes made)

. replace CID=    520     if countrycode=="NRU"
(0 real changes made)

. replace CID=    524     if countrycode=="NPL"
(52 real changes made)

. replace CID=    528     if countrycode=="NLD"
(52 real changes made)

. replace CID=    530     if countrycode=="ANT"
(0 real changes made)

. replace CID=    540     if countrycode=="NCL"
(52 real changes made)

. replace CID=    554     if countrycode=="NZL"
(52 real changes made)

. replace CID=    558     if countrycode=="NIC"
(52 real changes made)

. replace CID=    562     if countrycode=="NER"
(52 real changes made)

. replace CID=    566     if countrycode=="NGA"
(52 real changes made)

. replace CID=    570     if countrycode=="NIU"
(0 real changes made)

. replace CID=    574     if countrycode=="NFK"
(0 real changes made)

. replace CID=    580     if countrycode=="MNP"
(0 real changes made)

. replace CID=    578     if countrycode=="NOR"
(52 real changes made)

. replace CID=    512     if countrycode=="OMN"
(52 real changes made)

. replace CID=    586     if countrycode=="PAK"
(52 real changes made)

. replace CID=    585     if countrycode=="PLW"
(52 real changes made)

. replace CID=    275     if countrycode=="PSE"
(0 real changes made)

. replace CID=    591     if countrycode=="PAN"
(52 real changes made)

. replace CID=    598     if countrycode=="PNG"
(52 real changes made)

. replace CID=    600     if countrycode=="PRY"
(52 real changes made)

. replace CID=    604     if countrycode=="PER"
(52 real changes made)

. replace CID=    608     if countrycode=="PHL"
(52 real changes made)

. replace CID=    612     if countrycode=="PCN"
(0 real changes made)

. replace CID=    616     if countrycode=="POL"
(52 real changes made)

. replace CID=    620     if countrycode=="PRT"
(52 real changes made)

. replace CID=    630     if countrycode=="PRI"
(52 real changes made)

. replace CID=    634     if countrycode=="QAT"
(52 real changes made)

. replace CID=    642     if countrycode=="ROU"
(0 real changes made)

. replace CID=    643     if countrycode=="RUS"
(52 real changes made)

. replace CID=    646     if countrycode=="RWA"
(52 real changes made)

. replace CID=    638     if countrycode=="REU"
(0 real changes made)

. replace CID=    654     if countrycode=="SHN"
(0 real changes made)

. replace CID=    659     if countrycode=="KNA"
(52 real changes made)

. replace CID=    662     if countrycode=="LCA"
(52 real changes made)

. replace CID=    666     if countrycode=="SPM"
(0 real changes made)

. replace CID=    670     if countrycode=="VCT"
(52 real changes made)

. replace CID=    652     if countrycode=="BLM"
(0 real changes made)

. replace CID=    663     if countrycode=="MAF"
(0 real changes made)

. replace CID=    882     if countrycode=="WSM"
(52 real changes made)

. replace CID=    674     if countrycode=="SMR"
(52 real changes made)

. replace CID=    678     if countrycode=="STP"
(52 real changes made)

. replace CID=    682     if countrycode=="SAU"
(52 real changes made)

. replace CID=    686     if countrycode=="SEN"
(52 real changes made)

. replace CID=    688     if countrycode=="SRB"
(52 real changes made)

. replace CID=    690     if countrycode=="SYC"
(52 real changes made)

. replace CID=    694     if countrycode=="SLE"
(52 real changes made)

. replace CID=    702     if countrycode=="SGP"
(52 real changes made)

. replace CID=    703     if countrycode=="SVK"
(52 real changes made)

. replace CID=    705     if countrycode=="SVN"
(52 real changes made)

. replace CID=    90      if countrycode=="SLB"
(52 real changes made)

. replace CID=    706     if countrycode=="SOM"
(52 real changes made)

. replace CID=    710     if countrycode=="ZAF"
(52 real changes made)

. replace CID=    239     if countrycode=="SGS"
(0 real changes made)

. replace CID=    728     if countrycode=="SSD"
(0 real changes made)

. replace CID=    724     if countrycode=="ESP"
(52 real changes made)

. replace CID=    144     if countrycode=="LKA"
(52 real changes made)

. replace CID=    736     if countrycode=="SDN"
(52 real changes made)

. replace CID=    740     if countrycode=="SUR"
(52 real changes made)

. replace CID=    744     if countrycode=="SJM"
(0 real changes made)

. replace CID=    748     if countrycode=="SWZ"
(52 real changes made)

. replace CID=    752     if countrycode=="SWE"
(52 real changes made)

. replace CID=    756     if countrycode=="CHE"
(52 real changes made)

. replace CID=    760     if countrycode=="SYR"
(52 real changes made)

. replace CID=    158     if countrycode=="TWN"
(0 real changes made)

. replace CID=    762     if countrycode=="TJK"
(52 real changes made)

. replace CID=    834     if countrycode=="TZA"
(52 real changes made)

. replace CID=    764     if countrycode=="THA"
(52 real changes made)

. replace CID=    626     if countrycode=="TLS"
(0 real changes made)

. replace CID=    768     if countrycode=="TGO"
(52 real changes made)

. replace CID=    772     if countrycode=="TKL"
(0 real changes made)

. replace CID=    776     if countrycode=="TON"
(52 real changes made)

. replace CID=    780     if countrycode=="TTO"
(52 real changes made)

. replace CID=    788     if countrycode=="TUN"
(52 real changes made)

. replace CID=    792     if countrycode=="TUR"
(52 real changes made)

. replace CID=    795     if countrycode=="TKM"
(52 real changes made)

. replace CID=    796     if countrycode=="TCA"
(0 real changes made)

. replace CID=    798     if countrycode=="TUV"
(0 real changes made)

. replace CID=    800     if countrycode=="UGA"
(52 real changes made)

. replace CID=    804     if countrycode=="UKR"
(52 real changes made)

. replace CID=    784     if countrycode=="ARE"
(52 real changes made)

. replace CID=    826     if countrycode=="GBR"
(52 real changes made)

. replace CID=    581     if countrycode=="UMI"
(0 real changes made)

. replace CID=    840     if countrycode=="USA"
(52 real changes made)

. replace CID=    858     if countrycode=="URY"
(52 real changes made)

. replace CID=    860     if countrycode=="UZB"
(52 real changes made)

. replace CID=    548     if countrycode=="VUT"
(52 real changes made)

. replace CID=    862     if countrycode=="VEN"
(52 real changes made)

. replace CID=    704     if countrycode=="VNM"
(52 real changes made)

. replace CID=    850     if countrycode=="VIR"
(52 real changes made)

. replace CID=    876     if countrycode=="WLF"
(0 real changes made)

. replace CID=    732     if countrycode=="ESH"
(0 real changes made)

. replace CID=    887     if countrycode=="YEM"
(52 real changes made)

. replace CID=    894     if countrycode=="ZMB"
(52 real changes made)

. replace CID=    716     if countrycode=="ZWE"
(52 real changes made)

. 
. 
end of do-file

. rename country nation 

. replace CID=642 if countrycode=="ROM"
(52 real changes made)

. tab nation if CID==.

                      country |      Freq.     Percent        Cum.
------------------------------+-----------------------------------
                      Andorra |         52        6.25        6.25
               Congo, Dem Rep |         52        6.25       12.50
        East Asia and Pacific |         52        6.25       18.75
      Europe and Central Asia |         52        6.25       25.00
                  High income |         52        6.25       31.25
  Latin America and Caribbean |         52        6.25       37.50
                   Low income |         52        6.25       43.75
          Lower middle income |         52        6.25       50.00
 Middle East and North Africa |         52        6.25       56.25
                North America |         52        6.25       62.50
                   South Asia |         52        6.25       68.75
           Sub-Saharan Africa |         52        6.25       75.00
                  Timor-Leste |         52        6.25       81.25
          Upper middle income |         52        6.25       87.50
           West Bank and Gaza |         52        6.25       93.75
                        World |         52        6.25      100.00
------------------------------+-----------------------------------
                        Total |        832      100.00

. drop if CID==.
(832 observations deleted)

. order CID nation year, first 

. save KOFGI.dta, replace 
file KOFGI.dta saved

. 
. //      #3
. // Homicide Data
. use CT00-PridemoreMerge, clear 

. 
. //      #4
. //      Merging data 
. merge 1:1 CID year using 00-Fraser.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                        17,091
        from master                    17,069  (_merge==1)
        from using                         22  (_merge==2)

    Matched                             3,458  (_merge==3)
    -----------------------------------------

. drop _merge 

. merge 1:1 CID year using SP00-PridemoreMerge.dta
(variable year was int, now double to accommodate using data's values)
(variable countrycode was str3, now str4 to accommodate using data's values)

    Result                      Number of obs
    -----------------------------------------
    Not matched                         5,391
        from master                     4,918  (_merge==1)
        from using                        473  (_merge==2)

    Matched                            15,631  (_merge==3)
    -----------------------------------------

. drop _merge 

. merge 1:1 CID year using SPOECD.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                        22,656
        from master                    21,022  (_merge==1)
        from using                      1,634  (_merge==2)

    Matched                                 0  (_merge==3)
    -----------------------------------------

. drop  _merge 

. merge 1:1 CID year using KOFGI.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                        12,308
        from master                    12,308  (_merge==1)
        from using                          0  (_merge==2)

    Matched                            10,348  (_merge==3)
    -----------------------------------------

. drop _merge 

. 
. //      #5
. //      Cleaning up 
. gen HOM=. 
(22,656 missing values generated)

. gen MARKET=.
(22,656 missing values generated)

. gen GLOBAL=.
(22,656 missing values generated)

. 
. order  CID nation year regioncode regionname countrycode  region subregion ///
>                  region_un region_un_sub region_wb eu oecd incomegroup ///
>         HOM  rhom rfhom rmhom rhom1519 rhom2024 rhom2529 rhom3034 ///
>                 rhom3539 rhom4044 rhom4549 rhom5054 rhom5559 rhom6064 rhom7074
>  ///
>         MARKET  fraser heritage rol ///
>         GLOBAL  KOFGI KOFGIdf KOFGIdj KOFEcGI KOFEcGIdf KOFEcGIdj ///
>                 KOFTrGI KOFTrGIdf KOFTrGIdj KOFFiGI KOFFiGIdf KOFFiGIdj ///
>                 KOFSoGI KOFSoGIdf KOFSoGIdj KOFIpGI KOFIpGIdf KOFIpGIdj ///
>                 KOFInGI KOFInGIdf KOFInGIdj KOFCuGI KOFCuGIdf KOFCuGIdj ///
>                 KOFPoGI KOFPoGIdf KOFPoGIdj ///
>         PROTECT remit private_sp public_sp edu_exp healthexpend hdi ///
>          POLITIC cont_corrupt gov_eff pol_stab regulatory ruleoflaw voice_acco
> unt, first 

. 
. //      #6       
. //      save and close 
. save `file'.dta, replace 
file MAR01-DataClean.dta saved

. saveold `file'-old.dta, replace v(11)
(saving in Stata 12 format, which Stata 11 can read)
file MAR01-DataClean-old.dta saved

. log close 
      name:  <unnamed>
       log:  R:\Current Research\Markets-Pridemore\Work\MAR01-DataClean.log
  log type:  text
 closed on:  25 Jun 2024, 15:01:14
--------------------------------------------------------------------------------
